<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>消息中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layadmin/style/admin.css" media="all">
</head>
<style>
  .layui-upload-img{width: 92px; height: 92px; margin: 0 10px 10px 0;}
  </style>
<body>
    <div class="layui-fluid" id="LAY-app-message">
        <div class="layui-card">
            <div class="layui-tab layui-tab-brief">
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">分组<span style="color: red;">*</span></label>
                                <div class="layui-input-block">
                                    <select name="cid" lay-verify="required">
                                        <option value="">无分组</option>
                                        {volist name="category" id="v"}
                                        <option value="{$v.id}" {if condition="$mess.cid eq $v.id"}selected{/if}>{$v.name}</option>
                                        {/volist}
                                      </select>
                                </div>
                            </div>                                            
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="id" value="{$mess.id}">
                                    <button class="layui-btn" lay-submit lay-filter="save_about">确认保存</button>
                                     <button  class="layui-btn layui-btn-primary formCancel" >取消</button>
                                </div>
                            </div>
                        </div>
                    </div>        
                </div>
            </div>
        </div>
    </div>
    <script src="/static/layadmin/layui/layui.js"></script>
    <script src="/static/plugins/editor/kindeditor-4.1.11-zh-CN/kindeditor-all-min.js"></script>
    <script src="/static/plugins/editor/kindeditor-4.1.11-zh-CN/lang/zh-CN.js"></script>
    <script>
    KindEditor.ready(function(K) {
        window.editor = K.create('#content',{minHeight:400,afterBlur: function(){this.sync();}});
    });
    layui.config({
        base: '/static/layadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'upload','form','layedit'], function() {
        var $ = layui.jquery,
            upload = layui.upload,
            layedit = layui.layedit,
            form = layui.form;
        // layedit.build('content');layui自带富文本编辑器

        //多图片上传

        //监听提交
        form.on('submit(save_about)', function(data) {
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
            // layer.msg('表单已提交');
            console.log(field);
            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.post('/admin/filex/groupDone', {  id:field.id,cid: field.cid }, function(res) {
                res = $.parseJSON(res);
                console.log(res.code);
                if (res.code == 200) {
                    layer.msg(res.msg, {
                        icon: 1,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function() {    
                        // parent.layui.table.reload('list-table'); //重载表格
                        parent.location.reload();
                        parent.layer.close(index); //再执行关闭                    
                        // window.location.reload();
                    });
                } else {
                    layer.msg(res.msg, { icon: 2, time: 2000 });
                }
            });
        });
        $('.formCancel').on('click', function () {
          var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
          parent.layer.close(index); //再执行关闭 
        });   
    });
    </script>
</body>

</html>